import request from '@/utils/request'

// 分页查询需求表 /demand/queryPage post
export function getDemandPage(data) {
  return request({
    url: '/demand/queryPage',
    method: 'post',
    data
  })
}
// 获取需求唯一编号(添加需求时调用) /demand/getDemandCode get
export function getDemandRandomCode() {
  return request({
    url: '/demand/getDeNo',
    method: 'get'
  })
}
// 新建需求 /demand/create post
export function createDemand(data) {
  return request({
    url: '/demand/create',
    method: 'post',
    data
  })
}
// 跳转详情（新建需求/关联合同点击确定后调的接口）/demand/getById?id={需求id} get
export function getDemandDetail(requirementId) {
  return request({
    url: '/demand/getById?id=' + requirementId,
    method: 'get',
  })
}
// 关联合同  /demand/relevance POST
export function relevanceContract(data) {
  return request({
    url: '/demand/relevance',
    method: 'post',
    data
  })
}

// 删除  /demand/remove?id= get
export function removeDemand(requirementId) {
  return request({
    url: '/demand/remove?id=' + requirementId,
    method: 'get',
  })
}
// 导入数据 /demand/uploadData?file=&id=1 post 上传文件
export function uploadData(data) {
  return request({
    url: '/demand/uploadData',
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}

// 编辑需求 /demand/editor get
export function editorDemand(data) {
  return request({
    url: '/demand/editor',
    method: 'post',
    data
  })
}

// 编辑需求基础信息 /demand/editorBa get
export function editorDemandBa(data) {
  return request({
    url: '/demand/editorBa',
    method: 'post',
    data
  })
}
// 查询未关联的合同列表（关联合同时调） /demand/getNotAssociatedCon get
export function getNotAssociatedCon() {
  return request({
    url: '/demand/getNotAssociatedCon',
    method: 'get'
  })
}
